package com.xbn.netty.nio;

        import java.nio.ByteBuffer;

/**
 * @author XBN
 * @date 2020/10/13 22:40
 * @email 78742541@qq.com
 */
/*
结论：使用过byteBuffer的时候， 使用某个类型的put  ，
那么get的时候就用某个类型的get，比如putChar对应getChar
* */
public class ByteBufferPutGet {
    public static void main(String[] args) {
        ByteBuffer byteBuffer=ByteBuffer.allocate(64);
        //put
        byteBuffer.putLong(100);
        byteBuffer.putInt(9);
        byteBuffer.putChar('哈');
        byteBuffer.putShort((short) 4);
        //get
        byteBuffer.flip();
        System.out.println(byteBuffer.getLong());
        System.out.println(byteBuffer.getInt());
        System.out.println(byteBuffer.getLong());
        System.out.println(byteBuffer.getShort());
    }
}
